<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryRef" :inline="true" label-width="120px">
      <el-form-item label="模型名称" prop="modelName">
        <el-input v-model="queryParams.modelName" placeholder="请输入模型名称" clearable @keyup.enter="handleQuery" />
      </el-form-item>
      <el-form-item label="省" prop="province">
        <el-select v-model="queryParams.province" placeholder="请选择省" @change="chooseProvince" clearable>
          <el-option v-for="item in provinceData" :key="item.id" :label="item.name" :value="item.id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="市" prop="city">
        <el-select v-model="queryParams.city" placeholder="请选择市" @change="chooseCity" clearable>
          <el-option v-for="item in cityData" :key="item.id" :label="item.name" :value="item.id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label=" ">
        <el-button type="primary" @click="handleQuery">搜索</el-button>
        <el-button plain @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-table v-loading="loading" :data="casualtiesList" stripe>
      <el-table-column label="模型名称" align="center" prop="modelName">
        <template #default="scope">
          <el-button type="text" @click="edit(scope.row)">
            {{ scope.row.modelName }}
          </el-button>
        </template>
      </el-table-column>
      <el-table-column label="省" align="center" prop="province" />
      <el-table-column label="市" align="center" prop="city" />
      <el-table-column label="是否默认" align="center" prop="isDefault">
        <template #default="scope">
          <span v-if="scope.row.isDefault == '0'">否</span>
          <span v-if="scope.row.isDefault == '1'">是</span>
        </template>
      </el-table-column>
      <el-table-column label="维护人" align="center" prop="createUserName" />
      <el-table-column label="维护人所属单位" align="center" prop="orgName" />
    </el-table>

    <pagination v-show="total > 0" :total="total" v-model:page="queryParams.page" v-model:limit="queryParams.rows"
      @pagination="getList" />

    <el-dialog :title="title" v-model="open" width="850px" append-to-body custom-class="economic-model-dialog" destroy-on-close>
      <el-scrollbar>
        <el-form ref="economicRef" :model="form" :rules="rules" label-width="120px" scroll-to-error>
          <p class="dialogTitle">{{ title }}</p>
          <el-row>
            <el-col :span="12">
              <el-form-item label="模型名称：" prop="modelName" v-if="isCopy">
                {{ form.modelName }}
              </el-form-item>
              <el-form-item label="模型名称：" prop="modelName" v-else>
                <el-input v-model="form.modelName" placeholder="请输入模型名称" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="是否默认：" prop="" v-if="isCopy">
                {{ form.isDefault == '0' ? '否' : '是' }}
              </el-form-item>
              <el-form-item label="是否默认：" prop="" v-else>
                <el-select v-model="form.isDefault" disabled style="width: 100%;">
                  <el-option v-for="item in [
                    { value: '0', label: '否' },
                    { value: '1', label: '是' },
                  ]" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="地区：" prop="" v-if="isCopy || isEditDefault">
                {{ form.provinceName }} - {{ form.cityName || form.city }}
              </el-form-item>
              <el-form-item label="地区：" prop="" v-else>
                <el-form-item label="省" prop="provinceId" label-width="50px">
                  <el-select v-model="form.provinceId" placeholder="请输入省" @change="chooseFormProvince"
                    style="width: 160px;">
                    <el-option v-for="item in provinceFormData" :key="item.id" :label="item.name" :value="item.id">
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-col :span="16">
                  <el-form-item label="市" prop="" label-width="50px">
                    <el-radio-group v-model="radio" @change="chooseRadio">
                      <el-radio label="1">全部</el-radio>
                      <el-radio label="2">
                        <el-select v-model="form.cityId" placeholder="请输入市" multiple collapse-tags :disabled="isCityEdit"
                          style="width: 200px;">
                          <el-option v-for="item in cityFormData" :key="item.id" :label="item.name" :value="item.id">
                          </el-option>
                        </el-select>
                      </el-radio>
                    </el-radio-group>
                  </el-form-item>
                </el-col>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="维护人：" prop="">
                {{ form.createUserName }}
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="维护人单位：" prop="">
                {{ form.orgName }}
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="6" class="tab-title">
              建筑物经济损失评估模型
            </el-col>
          </el-row>
          <el-row style="margin-bottom: 20px;">
            <el-col :span="6" :offset="1">
              （1）建筑物结构经济损失
            </el-col>
          </el-row>
          <el-row justify="center" v-if="isCopy">
            <el-col :span="14">
              <vue-latex :expression="'E_f=\\sum\\limits_{s}\\sum\\limits_{j}(S_{sj}*P_s*L_{sj})*\\delta I/10000'" />
              <p>式中：</p>
              <p><vue-latex :expression="'E_f'" /> -- 表示建筑物结构经济损失；</p>
              <p><vue-latex :expression="'S_{sj}'" /> -- 表示建筑物破坏情况明细，公里格网<vue-latex :expression="'s'" />类建筑物j破坏等级的面积；</p>
              <p><vue-latex :expression="'P_s'" /> -- 表示建筑物每平方米造价，公里格网<vue-latex :expression="'s'" />类建筑物的每平方米造价；</p>
              <p><vue-latex :expression="'L_{sj}'" /> -- 表示建筑物损失比矩阵，<vue-latex :expression="'s'" />类建筑物在<vue-latex
                  :expression="'j'" />破坏等级下的损失比；</p>
              <p><vue-latex :expression="'\\delta I'" /> -- 表示评估调整参数。</p>
            </el-col>
          </el-row>
          <el-row justify="center" v-else>
            <el-col :span="14">
              <vue-latex :expression="'E_f=\\sum\\limits_{s}\\sum\\limits_{j}(S_{sj}*P_s*L_{sj})*'" />
              <el-form-item prop="structureLossess" style="display: inline-block;" label-width="0px">
                <el-input-number v-model="form.structureLossess" placeholder="" style="width: 100px;" />
              </el-form-item>
              <vue-latex :expression="'/10000'" />
              <p>式中：</p>
              <p><vue-latex :expression="'E_f'" /> -- 表示建筑物结构经济损失；</p>
              <p><vue-latex :expression="'S_{sj}'" /> -- 表示建筑物破坏情况明细，公里格网<vue-latex :expression="'s'" />类建筑物j破坏等级的面积；</p>
              <p><vue-latex :expression="'P_s'" /> -- 表示建筑物每平方米造价，公里格网<vue-latex :expression="'s'" />类建筑物的每平方米造价；</p>
              <p><vue-latex :expression="'L_{sj}'" /> -- 表示建筑物损失比矩阵，<vue-latex :expression="'s'" />类建筑物在<vue-latex
                  :expression="'j'" />破坏等级下的损失比；</p>
              <p><vue-latex :expression="'\\delta I'" /> -- 表示评估调整参数。</p>
            </el-col>
          </el-row>
          <el-row style="margin-bottom: 20px;">
            <el-col :span="6" :offset="1">
              （2）建筑物室内财产经济损失
            </el-col>
          </el-row>
          <el-row justify="center">
            <el-col :span="14">
              <template v-if="isCopy">
                <vue-latex :expression="'E_e=\\sum\\limits_{s}\\sum\\limits_{j}(S_{sj}*P_s*L_{sj})*\\delta I/10000'" />
              </template>
              <template v-else>
                <vue-latex :expression="'E_e=\\sum\\limits_{s}\\sum\\limits_{j}(S_{sj}*P_s*L_{sj})*'" />
                <el-form-item prop="indoorLossess" style="display: inline-block;" label-width="0px">
                  <el-input-number v-model="form.indoorLossess" placeholder="" style="width: 100px;" />
                </el-form-item>
                <vue-latex :expression="'/10000'" />
              </template>
              <p>式中：</p>
              <p><vue-latex :expression="'E_e'" /> -- 表示建筑物结构经济损失；</p>
              <p><vue-latex :expression="'S_{sj}'" /> -- 表示建筑物破坏情况明细，公里格网<vue-latex :expression="'s'" />类建筑物j破坏等级的面积；</p>
              <p><vue-latex :expression="'P_e'" /> -- 表示建筑物室内财产；</p>
              <p><vue-latex :expression="'L_{sj}'" /> -- 表示建筑物损失比矩阵，<vue-latex :expression="'s'" />类建筑物在<vue-latex
                  :expression="'j'" />破坏等级下的损失比；</p>
              <p><vue-latex :expression="'\\delta I'" /> -- 表示评估调整参数。</p>
            </el-col>
          </el-row>
          <el-row justify="center">
            <el-col :span="22">
              <div style="margin-top:10px;line-height: 30px;">
                <table align="center" style="width: 100%;border-collapse: collapse;">
                  <caption>建筑物损失比矩阵样例：</caption>
                  <tr>
                    <td rowspan="2" align="center">编号</td>
                    <td rowspan="2" colspan="2" align="center">房屋类型</td>
                    <td colspan="5" align="center">破坏等级</td>
                  </tr>
                  <tr>
                    <td style="width: 100px;" align="center" valign="middle">基本完好</td>
                    <td style="width: 100px;" align="center" valign="middle">轻微破坏</td>
                    <td style="width: 100px;" align="center" valign="middle">中等破坏</td>
                    <td style="width: 100px;" align="center" valign="middle">严重破坏</td>
                    <td style="width: 100px;" align="center" valign="middle">毁坏</td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle" rowspan="2">1</td>
                    <td align="center" valign="middle" rowspan="2">钢筋混凝土、砌体房屋</td>
                    <td align="center" valign="middle">范围</td>
                    <td align="center" valign="middle">0~5</td>
                    <td align="center" valign="middle">6~15</td>
                    <td align="center" valign="middle">16~45</td>
                    <td align="center" valign="middle">46~80</td>
                    <td align="center" valign="middle">81~100</td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle">中值</td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.basic1 }} </div>
                      <div v-else>
                        <el-form-item prop="basic1" label-width="0px">
                          <el-input-number v-model="form.basic1" placeholder="[0,5]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.slight1 }} </div>
                      <div v-else>
                        <el-form-item prop="slight1" label-width="0px">
                          <el-input-number v-model="form.slight1" placeholder="[6,15]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.mid1 }} </div>
                      <div v-else>
                        <el-form-item prop="mid1" label-width="0px">
                          <el-input-number v-model="form.mid1" placeholder="[16,45]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.serious1 }} </div>
                      <div v-else>
                        <el-form-item prop="serious1" label-width="0px">
                          <el-input-number v-model="form.serious1" placeholder="[46,80]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.destroy1 }} </div>
                      <div v-else>
                        <el-form-item prop="destroy1" label-width="0px">
                          <el-input-number v-model="form.destroy1" placeholder="[80,100]" />
                        </el-form-item>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle" rowspan="2">2</td>
                    <td align="center" valign="middle" rowspan="2">工业厂房</td>
                    <td align="center" valign="middle">范围</td>
                    <td align="center" valign="middle">0~4</td>
                    <td align="center" valign="middle">5~16</td>
                    <td align="center" valign="middle">17~45</td>
                    <td align="center" valign="middle">46~80</td>
                    <td align="center" valign="middle">81~100</td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle">中值</td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.basic2 }} </div>
                      <div v-else>
                        <el-form-item prop="basic2" label-width="0px">
                          <el-input-number v-model="form.basic2" placeholder="[0,4]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.slight2 }} </div>
                      <div v-else>
                        <el-form-item prop="slight2" label-width="0px">
                          <el-input-number v-model="form.slight2" placeholder="[5,16]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.mid2 }} </div>
                      <div v-else>
                        <el-form-item prop="mid2" label-width="0px">
                          <el-input-number v-model="form.mid2" placeholder="[17,45]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.serious2 }} </div>
                      <div v-else>
                        <el-form-item prop="serious2" label-width="0px">
                          <el-input-number v-model="form.serious2" placeholder="[46,80]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.destroy2 }} </div>
                      <div v-else>
                        <el-form-item prop="destroy2" label-width="0px">
                          <el-input-number v-model="form.destroy2" placeholder="[81,100]" />
                        </el-form-item>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle" rowspan="2">3</td>
                    <td align="center" valign="middle" rowspan="2">城镇平房、农村平房</td>
                    <td align="center" valign="middle">范围</td>
                    <td align="center" valign="middle">0~5</td>
                    <td align="center" valign="middle">6~15</td>
                    <td align="center" valign="middle">16~40</td>
                    <td align="center" valign="middle">41~70</td>
                    <td align="center" valign="middle">71~100</td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle">中值</td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.basic3 }} </div>
                      <div v-else>
                        <el-form-item prop="basic3" label-width="0px">
                          <el-input-number v-model="form.basic3" placeholder="[0,5]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.slight3 }} </div>
                      <div v-else>
                        <el-form-item prop="slight3" label-width="0px">
                          <el-input-number v-model="form.slight3" placeholder="[6,15]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.mid3 }} </div>
                      <div v-else>
                        <el-form-item prop="mid3" label-width="0px">
                          <el-input-number v-model="form.mid3" placeholder="[16,40]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.serious3 }} </div>
                      <div v-else>
                        <el-form-item prop="serious3" label-width="0px">
                          <el-input-number v-model="form.serious3" placeholder="[41,70]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.destroy3 }} </div>
                      <div v-else>
                        <el-form-item prop="destroy3" label-width="0px">
                          <el-input-number v-model="form.destroy3" placeholder="[70,100]" />
                        </el-form-item>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle" rowspan="2">4</td>
                    <td align="center" valign="middle" rowspan="2">钢筋混凝土居住房屋</td>
                    <td align="center" valign="middle">范围</td>
                    <td align="center" valign="middle">0~5</td>
                    <td align="center" valign="middle">5~20</td>
                    <td align="center" valign="middle">20~55</td>
                    <td align="center" valign="middle">55~80</td>
                    <td align="center" valign="middle">80~100</td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle">中值</td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.basic4 }} </div>
                      <div v-else>
                        <el-form-item prop="basic4" label-width="0px">
                          <el-input-number v-model="form.basic4" placeholder="[0,5]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.slight4 }} </div>
                      <div v-else>
                        <el-form-item prop="slight4" label-width="0px">
                          <el-input-number v-model="form.slight4" placeholder="[5,20]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.mid4 }} </div>
                      <div v-else>
                        <el-form-item prop="mid4" label-width="0px">
                          <el-input-number v-model="form.mid4" placeholder="[20,55]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.serious4 }} </div>
                      <div v-else>
                        <el-form-item prop="serious4" label-width="0px">
                          <el-input-number v-model="form.serious4" placeholder="[55,80]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.destroy4 }} </div>
                      <div v-else>
                        <el-form-item prop="destroy4" label-width="0px">
                          <el-input-number v-model="form.destroy4" placeholder="[80,100]" />
                        </el-form-item>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle" rowspan="2">5</td>
                    <td align="center" valign="middle" rowspan="2">砖结构居住房屋</td>
                    <td align="center" valign="middle">范围</td>
                    <td align="center" valign="middle">0~5</td>
                    <td align="center" valign="middle">5~20</td>
                    <td align="center" valign="middle">20~50</td>
                    <td align="center" valign="middle">50~75</td>
                    <td align="center" valign="middle">75~100</td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle">中值</td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.basic5 }} </div>
                      <div v-else>
                        <el-form-item prop="basic5" label-width="0px">
                          <el-input-number v-model="form.basic5" placeholder="[0,5]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.slight5 }} </div>
                      <div v-else>
                        <el-form-item prop="slight5" label-width="0px">
                          <el-input-number v-model="form.slight5" placeholder="[5,20]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.mid5 }} </div>
                      <div v-else>
                        <el-form-item prop="mid5" label-width="0px">
                          <el-input-number v-model="form.mid5" placeholder="[20,50]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.serious5 }} </div>
                      <div v-else>
                        <el-form-item prop="serious5" label-width="0px">
                          <el-input-number v-model="form.serious5" placeholder="[50,75]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.destroy5 }} </div>
                      <div v-else>
                        <el-form-item prop="destroy5" label-width="0px">
                          <el-input-number v-model="form.destroy5" placeholder="[75,100]" />
                        </el-form-item>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle" rowspan="2">6</td>
                    <td align="center" valign="middle" rowspan="2">写字楼</td>
                    <td align="center" valign="middle">范围</td>
                    <td align="center" valign="middle">0~5</td>
                    <td align="center" valign="middle">5~20</td>
                    <td align="center" valign="middle">20~55</td>
                    <td align="center" valign="middle">55~80</td>
                    <td align="center" valign="middle">80~100</td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle">中值</td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.basic6 }} </div>
                      <div v-else>
                        <el-form-item prop="basic6" label-width="0px">
                          <el-input-number v-model="form.basic6" placeholder="[0,5]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.slight6 }} </div>
                      <div v-else>
                        <el-form-item prop="slight6" label-width="0px">
                          <el-input-number v-model="form.slight6" placeholder="[5,20]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.mid6 }} </div>
                      <div v-else>
                        <el-form-item prop="mid6" label-width="0px">
                          <el-input-number v-model="form.mid6" placeholder="[20,55]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.serious6 }} </div>
                      <div v-else>
                        <el-form-item prop="serious6" label-width="0px">
                          <el-input-number v-model="form.serious6" placeholder="[55,80]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.destroy6 }} </div>
                      <div v-else>
                        <el-form-item prop="destroy6" label-width="0px">
                          <el-input-number v-model="form.destroy6" placeholder="[80,100]" />
                        </el-form-item>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle" rowspan="2">7</td>
                    <td align="center" valign="middle" rowspan="2">公共建筑</td>
                    <td align="center" valign="middle">范围</td>
                    <td align="center" valign="middle">0~5</td>
                    <td align="center" valign="middle">5~20</td>
                    <td align="center" valign="middle">20~50</td>
                    <td align="center" valign="middle">50~75</td>
                    <td align="center" valign="middle">75~100</td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle">中值</td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.basic7 }} </div>
                      <div v-else>
                        <el-form-item prop="basic7" label-width="0px">
                          <el-input-number v-model="form.basic7" placeholder="[0,5]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.slight7 }} </div>
                      <div v-else>
                        <el-form-item prop="slight7" label-width="0px">
                          <el-input-number v-model="form.slight7" placeholder="[5,20]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.mid7 }} </div>
                      <div v-else>
                        <el-form-item prop="mid7" label-width="0px">
                          <el-input-number v-model="form.mid7" placeholder="[20,50]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.serious7 }} </div>
                      <div v-else>
                        <el-form-item prop="serious7" label-width="0px">
                          <el-input-number v-model="form.serious7" placeholder="[50,75]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.destroy7 }} </div>
                      <div v-else>
                        <el-form-item prop="destroy7" label-width="0px">
                          <el-input-number v-model="form.destroy7" placeholder="[75,100]" />
                        </el-form-item>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle" rowspan="2">8</td>
                    <td align="center" valign="middle" rowspan="2">工业建筑</td>
                    <td align="center" valign="middle">范围</td>
                    <td align="center" valign="middle">0~2</td>
                    <td align="center" valign="middle">2~15</td>
                    <td align="center" valign="middle">15~50</td>
                    <td align="center" valign="middle">50~75</td>
                    <td align="center" valign="middle">75~100</td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle">中值</td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.basic8 }} </div>
                      <div v-else>
                        <el-form-item prop="basic8" label-width="0px">
                          <el-input-number v-model="form.basic8" placeholder="[0,2]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.slight8 }} </div>
                      <div v-else>
                        <el-form-item prop="slight8" label-width="0px">
                          <el-input-number v-model="form.slight8" placeholder="[2,15]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.mid8 }} </div>
                      <div v-else>
                        <el-form-item prop="mid8" label-width="0px">
                          <el-input-number v-model="form.mid8" placeholder="[15,50]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.serious8 }} </div>
                      <div v-else>
                        <el-form-item prop="serious8" label-width="0px">
                          <el-input-number v-model="form.serious8" placeholder="[50,75]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.destroy8 }} </div>
                      <div v-else>
                        <el-form-item prop="destroy8" label-width="0px">
                          <el-input-number v-model="form.destroy8" placeholder="[75,100]" />
                        </el-form-item>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle" rowspan="2">9</td>
                    <td align="center" valign="middle" rowspan="2">农村房屋</td>
                    <td align="center" valign="middle">范围</td>
                    <td align="center" valign="middle">0~1</td>
                    <td align="center" valign="middle">1~10</td>
                    <td align="center" valign="middle">10~40</td>
                    <td align="center" valign="middle">40~75</td>
                    <td align="center" valign="middle">75~100</td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle">中值</td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.basic9 }} </div>
                      <div v-else>
                        <el-form-item prop="basic9" label-width="0px">
                          <el-input-number v-model="form.basic9" placeholder="[0,1]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.slight9 }} </div>
                      <div v-else>
                        <el-form-item prop="slight9" label-width="0px">
                          <el-input-number v-model="form.slight9" placeholder="[1,10]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.mid9 }} </div>
                      <div v-else>
                        <el-form-item prop="mid9" label-width="0px">
                          <el-input-number v-model="form.mid9" placeholder="[10,40]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.serious9 }} </div>
                      <div v-else>
                        <el-form-item prop="serious9" label-width="0px">
                          <el-input-number v-model="form.serious9" placeholder="[40,75]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.destroy9 }} </div>
                      <div v-else>
                        <el-form-item prop="destroy9" label-width="0px">
                          <el-input-number v-model="form.destroy9" placeholder="[75,100]" />
                        </el-form-item>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle" rowspan="2">10</td>
                    <td align="center" valign="middle" rowspan="2">市内财产</td>
                    <td align="center" valign="middle">范围</td>
                    <td align="center" valign="middle">0</td>
                    <td align="center" valign="middle">0</td>
                    <td align="center" valign="middle">0</td>
                    <td align="center" valign="middle">20~40</td>
                    <td align="center" valign="middle">40~95</td>
                  </tr>
                  <tr>
                    <td align="center" valign="middle">中值</td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.basic10 }} </div>
                      <div v-else>
                        <el-form-item prop="basic10" label-width="0px">
                          <el-input-number v-model="form.basic10" placeholder="[0]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.slight10 }} </div>
                      <div v-else>
                        <el-form-item prop="slight10" label-width="0px">
                          <el-input-number v-model="form.slight10" placeholder="[0]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.mid10 }} </div>
                      <div v-else>
                        <el-form-item prop="mid10" label-width="0px">
                          <el-input-number v-model="form.mid10" placeholder="[0]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.serious10 }} </div>
                      <div v-else>
                        <el-form-item prop="serious10" label-width="0px">
                          <el-input-number v-model="form.serious10" placeholder="[20,40]" />
                        </el-form-item>
                      </div>
                    </td>
                    <td align="center" valign="middle">
                      <div v-if="isCopy"> {{ form.destroy10 }} </div>
                      <div v-else>
                        <el-form-item prop="destroy10" label-width="0px">
                          <el-input-number v-model="form.destroy10" placeholder="[40,95]" />
                        </el-form-item>
                      </div>
                    </td>
                  </tr>
                </table>
              </div>
            </el-col>
          </el-row>
          <el-row style="margin: 20px 0;">
            <el-col :span="6" :offset="1">
              （3）建筑物直接经济损失
            </el-col>
          </el-row>
          <el-row justify="center">
            <vue-latex :expression="'E_b=E_f+E_e'" />
          </el-row>
          <el-row justify="center">
            <el-col :span="18">
              <p><vue-latex :expression="'E_b'" /> 为建筑物直接经济损失，<vue-latex :expression="'E_f'" />为建筑物结构经济损失，<vue-latex
                  :expression="'E_e'" />为建筑物室内财产经济损失。</p>
            </el-col>
          </el-row>
          <el-row style="margin-top: 30px;">
            <el-col :span="6" class="tab-title">
              生命线经济损失评估
            </el-col>
          </el-row>
          <template v-if="isCopy">
            <el-row justify="center">
              <vue-latex :expression="'L_s=\\frac{E_b}{B_m}*L_m'" />
            </el-row>
            <el-row justify="center">
              <el-col :span=20>
                <p>
                  <vue-latex :expression="'L_s'" /> 为公里格网生命线经济损失，<vue-latex :expression="'E_b'" />为公里格网建筑物直接经济损失，<vue-latex
                    :expression="'B_m'" />为建筑物经济损失在总经济损失中所占百分比，<vue-latex :expression="'L_m'" />为生命线经济损失在总经济损失中所占百分比。
                </p>
              </el-col>
            </el-row>
          </template>
          <template v-else>
            <el-row justify="center">
              <span style="font-size: 16px;font-weight: bold;font-style: italic;">
                <vue-latex :expression="'L_s='" />
                <span style="position: absolute;top: -15px;margin-left: 15px;">
                  <vue-latex :expression="'E_b'" />
                </span>————
                <span style="position: absolute;top: 22px;margin-left: -70px;">
                  <el-form-item prop="lifeRatio1" style="display: inline-block;" label-width="0px">
                    <el-input-number v-model="form.lifeRatio1" placeholder="百分比" style="width: 70px;" />
                  </el-form-item>
                </span> *
                <el-form-item prop="lifeRatio2" style="display: inline-block;" label-width="0px">
                  <el-input-number v-model="form.lifeRatio2" placeholder="百分比" style="width: 70px;" />
                </el-form-item>
              </span>
            </el-row>
            <el-row justify="center">
              <el-col :span=20>
                <p>
                  <vue-latex :expression="'L_s'" />为公里格网生命线经济损失，<vue-latex :expression="'E_b'" />为公里格网建筑物直接经济损失，<vue-latex
                    :expression="'B_m'" />为建筑物经济损失在总经济损失中所占百分比，<vue-latex :expression="'L_m'" />为生命线经济损失在总经济损失中所占百分比。
                </p>
              </el-col>
            </el-row>
          </template>
          <el-row style="margin-top: 30px;">
            <el-col :span="6" class="tab-title">
              其他经济损失评估
            </el-col>
          </el-row>
          <template v-if="isCopy">
            <el-row justify="center">
              <vue-latex :expression="'O_s=\\frac{E_b}{B_m}*O_m'" />
            </el-row>
            <el-row justify="center">
              <el-col :span=20>
                <p>
                  <vue-latex :expression="'O_s'" />为公里格网生命线经济损失，<vue-latex :expression="'E_b'" />为公里格网建筑物直接经济损失，<vue-latex
                    :expression="'B_m'" />为建筑物经济损失在总经济损失中所占百分比，<vue-latex :expression="'O_m'" />为其他经济损失在总经济损失中所占百分比。
                </p>
              </el-col>
            </el-row>
          </template>
          <template v-else>
            <el-row justify="center">
              <span style="font-size: 16px;font-weight: bold;font-style: italic;">
                <vue-latex :expression="'O_s='" />
                <span style="position: absolute;top: -15px;margin-left: 15px;">
                  <vue-latex :expression="'E_b'" />
                </span>————
                <span style="position: absolute;top: 22px;margin-left: -70px;">
                  <el-form-item prop="otherRatio1" style="display: inline-block;" label-width="0px">
                    <el-input-number v-model="form.otherRatio1" placeholder="百分比" style="width: 70px;" />
                  </el-form-item>
                </span> *
                <el-form-item prop="otherRatio2" style="display: inline-block;" label-width="0px">
                  <el-input-number v-model="form.otherRatio2" placeholder="百分比" style="width: 70px;" />
                </el-form-item>
              </span>
            </el-row>
            <el-row justify="center">
              <el-col :span=20>
                <p>
                  <vue-latex :expression="'O_s'" />为公里格网生命线经济损失，<vue-latex :expression="'E_b'" />为公里格网建筑物直接经济损失，<vue-latex
                    :expression="'B_m'" />为建筑物经济损失在总经济损失中所占百分比，<vue-latex :expression="'O_m'" />为其他经济损失在总经济损失中所占百分比。
                </p>
              </el-col>
            </el-row>
          </template>
          <el-row style="margin-top: 30px;">
            <el-col :span="6" class="tab-title">
              直接经济损失评估
            </el-col>
          </el-row>
          <el-row justify="center">
            <vue-latex :expression="'E=E_b+L_s+O_s'" />
          </el-row>
          <el-row justify="center">
            <el-col :span="20">
              <vue-latex :expression="'E'" />为直接经济损失，<vue-latex :expression="'E_b'" />为建筑物直接经济损失，<vue-latex
                :expression="'L_s'" />为公里格网生命线经济损失，<vue-latex :expression="'O_s'" />为公里格网其他经济损失。
            </el-col>
          </el-row>
        </el-form>
      </el-scrollbar>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="copyForm" v-if="isCopy">复 制</el-button>
          <el-button type="primary" @click="saveForm" v-if="!isCopy && Default == '1'">保 存</el-button>
          <el-button type="primary" @click="editForm" v-if="!isCopy && Default == '0'">保 存</el-button>
          <el-button type="primary" @click="delForm" v-if="!isCopy && Default == '0'">删 除</el-button>
          <el-button plain @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup name="economicModel">
import { listEconomic, getModelEconomic, delEconomic, addEconomic, updateEconomic } from "@/api/modelManage/economic";
import { getProvince, getChildArea } from "@/api/system/division"
import { rangeValidate } from '@/utils/validate'

const { proxy } = getCurrentInstance();

const casualtiesList = ref([]);
const isCopy = ref(true);
const Default = ref("1");
const radio = ref("1");
const isCityEdit = ref(true);
const isEditDefault = ref(true);
const open = ref(false);
const loading = ref(true);
const total = ref(0);
const title = ref("");
const provinceData = ref([]);//省
const cityData = ref([]);//市
const areaData = ref([]);//区、县

const provinceFormData = ref([]);//表单省
const cityFormData = ref([]);//表单市
const areaFormData = ref([]);//表单区、县

//正数字正则
const positiveInteger = (rule, value, callback) => {
  value = String(value)
  if (isNaN(value) || !value) {
    return callback(new Error());
  }
  var re = /^[0-9]*$/;
  if (!re.test(value)) {
    callback(new Error(rule.message));
  } else {
    callback();
  }
}
const data = reactive({
  form: {},
  queryParams: {
    page: 1,
    rows: 10,
    province: null,
    city: null
  },
  rules: {
    taskCode: [{ required: true, message: "任务编号不能为空", trigger: "blur" }],
    modelName: [{ required: true, message: "模型名称不能为空", trigger: "blur" }],
    province: [{ required: true, message: "省不能为空", trigger: "blur" }],
    provinceId: [{ required: true, message: "省不能为空", trigger: "change" }],
    city: [{ required: true, message: "市不能为空", trigger: "blur" }],
    cityId: [{ required: true, message: "市不能为空", trigger: "blur" }],
    area: [{ required: true, message: "区/县不能为空", trigger: "blur" }],
    areaId: [{ required: true, message: "区/县 不能为空", trigger: "blur" }],
    basic1: [{ required: true, trigger: "blur", validator: rangeValidate, min: 0, max: 5 }],
    slight1: [{ required: true, trigger: "blur", validator: rangeValidate, min: 6, max: 15 }],
    mid1: [{ required: true, trigger: "blur", validator: rangeValidate, min: 16, max: 45 }],
    serious1: [{ required: true, trigger: "blur", validator: rangeValidate, min: 46, max: 80 }],
    destroy1: [{ required: true, trigger: "blur", validator: rangeValidate, min: 81, max: 100 }],
    basic2: [{ required: true, trigger: "blur", validator: rangeValidate, min: 0, max: 4 }],
    slight2: [{ required: true, trigger: "blur", validator: rangeValidate, min: 5, max: 16 }],
    mid2: [{ required: true, trigger: "blur", validator: rangeValidate, min: 17, max: 45 }],
    serious2: [{ required: true, trigger: "blur", validator: rangeValidate, min: 46, max: 80 }],
    destroy2: [{ required: true, trigger: "blur", validator: rangeValidate, min: 81, max: 100 }],
    basic3: [{ required: true, trigger: "blur", validator: rangeValidate, min: 0, max: 5 }],
    slight3: [{ required: true, trigger: "blur", validator: rangeValidate, min: 6, max: 15 }],
    mid3: [{ required: true, trigger: "blur", validator: rangeValidate, min: 16, max: 40 }],
    serious3: [{ required: true, trigger: "blur", validator: rangeValidate, min: 41, max: 70 }],
    destroy3: [{ required: true, trigger: "blur", validator: rangeValidate, min: 71, max: 100 }],
    basic4: [{ required: true, trigger: "blur", validator: rangeValidate, min: 0, max: 5 }],
    slight4: [{ required: true, trigger: "blur", validator: rangeValidate, min: 5, max: 20, closure: 'left' }],
    mid4: [{ required: true, trigger: "blur", validator: rangeValidate, min: 20, max: 55, closure: 'left' }],
    serious4: [{ required: true, trigger: "blur", validator: rangeValidate, min: 55, max: 80, closure: 'left' }],
    destroy4: [{ required: true, trigger: "blur", validator: rangeValidate, min: 80, max: 100, closure: 'left' }],
    basic5: [{ required: true, trigger: "blur", validator: rangeValidate, min: 0, max: 5, closure: 'left' }],
    slight5: [{ required: true, trigger: "blur", validator: rangeValidate, min: 5, max: 20, closure: 'left' }],
    mid5: [{ required: true, trigger: "blur", validator: rangeValidate, min: 20, max: 50, closure: 'left' }],
    serious5: [{ required: true, trigger: "blur", validator: rangeValidate, min: 50, max: 75, closure: 'left' }],
    destroy5: [{ required: true, trigger: "blur", validator: rangeValidate, min: 75, max: 100, closure: 'left' }],
    basic6: [{ required: true, trigger: "blur", validator: rangeValidate, min: 0, max: 5, closure: 'left' }],
    slight6: [{ required: true, trigger: "blur", validator: rangeValidate, min: 5, max: 20, closure: 'left' }],
    mid6: [{ required: true, trigger: "blur", validator: rangeValidate, min: 20, max: 55, closure: 'left' }],
    serious6: [{ required: true, trigger: "blur", validator: rangeValidate, min: 55, max: 80, closure: 'left' }],
    destroy6: [{ required: true, trigger: "blur", validator: rangeValidate, min: 80, max: 100, closure: 'left' }],
    basic7: [{ required: true, trigger: "blur", validator: rangeValidate, min: 0, max: 5, closure: 'left' }],
    slight7: [{ required: true, trigger: "blur", validator: rangeValidate, min: 5, max: 20, closure: 'left' }],
    mid7: [{ required: true, trigger: "blur", validator: rangeValidate, min: 20, max: 50, closure: 'left' }],
    serious7: [{ required: true, trigger: "blur", validator: rangeValidate, min: 50, max: 75, closure: 'left' }],
    destroy7: [{ required: true, trigger: "blur", validator: rangeValidate, min: 75, max: 100, closure: 'left' }],
    basic8: [{ required: true, trigger: "blur", validator: rangeValidate, min: 0, max: 2, closure: 'left' }],
    slight8: [{ required: true, trigger: "blur", validator: rangeValidate, min: 2, max: 15, closure: 'left' }],
    mid8: [{ required: true, trigger: "blur", validator: rangeValidate, min: 15, max: 50, closure: 'left' }],
    serious8: [{ required: true, trigger: "blur", validator: rangeValidate, min: 50, max: 75, closure: 'left' }],
    destroy8: [{ required: true, trigger: "blur", validator: rangeValidate, min: 75, max: 100, closure: 'left' }],
    basic9: [{ required: true, trigger: "blur", validator: rangeValidate, min: 0, max: 1, closure: 'left' }],
    slight9: [{ required: true, trigger: "blur", validator: rangeValidate, min: 1, max: 10, closure: 'left' }],
    mid9: [{ required: true, trigger: "blur", validator: rangeValidate, min: 10, max: 40, closure: 'left' }],
    serious9: [{ required: true, trigger: "blur", validator: rangeValidate, min: 40, max: 75, closure: 'left' }],
    destroy9: [{ required: true, trigger: "blur", validator: rangeValidate, min: 75, max: 100, closure: 'left' }],
    basic10: [{ required: true, trigger: "blur", validator: rangeValidate, min: 0, max: 0 }],
    slight10: [{ required: true, trigger: "blur", validator: rangeValidate, min: 0, max: 0 }],
    mid10: [{ required: true, trigger: "blur", validator: rangeValidate, min: 0, max: 0 }],
    serious10: [{ required: true, trigger: "blur", validator: rangeValidate, min: 20, max: 40 }],
    destroy10: [{ required: true, trigger: "blur", validator: rangeValidate, min: 40, max: 95, closure: 'left' }],
    structureLossess: [{ required: true, message: "请输入数字", trigger: "blur", validator: positiveInteger }],
    indoorLossess: [{ required: true, message: "请输入数字", trigger: "blur", validator: positiveInteger }],
    lifeRatio1: [{ required: true, message: "请输入数字", trigger: "blur", validator: positiveInteger }],
    lifeRatio2: [{ required: true, message: "请输入数字", trigger: "blur", validator: positiveInteger }],
    otherRatio1: [{ required: true, message: "请输入数字", trigger: "blur", validator: positiveInteger }],
    otherRatio2: [{ required: true, message: "请输入数字", trigger: "blur", validator: positiveInteger }],
  }
});

const { queryParams, form, rules } = toRefs(data);

// 列表
function getList() {
  loading.value = true;
  listEconomic(queryParams.value).then(response => {
    casualtiesList.value = response.data.rows;;
    total.value = response.data.total;
    loading.value = false;
  });
}

// 获取省市区县列表
function getProvinceData() {
  getProvince().then(response => {
    provinceData.value = response.data;
  });
}

function getProvinceFormData() {
  getProvince().then(response => {
    provinceFormData.value = response.data;
  });
}

function chooseRadio(value) {
  if (value == "2") {
    isCityEdit.value = false

  } else {
    isCityEdit.value = true
    form.value.city = "全部"
    form.value.cityId = ""
  }
}

function chooseProvince(value) {
  queryParams.value.city = null
  queryParams.value.area = null
  cityData.value = []
  areaData.value = []
  getChildArea(value).then(response => {
    cityData.value = response.data
  })
}

function chooseFormProvince(value) {
  form.value.city = null
  cityFormData.value = []
  areaFormData.value = []
  getChildArea(value).then(response => {
    cityFormData.value = response.data
  })
}

function chooseCity(value) {
  queryParams.value.areaId = null
  areaData.value = []
  getChildArea(value).then(response => {
    areaData.value = response.data
  })
}

// 取消按钮
function cancel() {
  open.value = false;
  reset();
}

// 表单重置
function reset() {
  form.value = {
    id: null,
    modelName: null,
    province: null,
    provinceId: null,
    city: null,
    cityId: null,
    areaId: null,
    isDefault: null
  }
  proxy.resetForm("economicRef")
}

// 搜索按钮
function handleQuery() {
  queryParams.value.page = 1
  getList()
}

// 重置按钮
function resetQuery() {
  cityData.value = []
  areaData.value = []
  proxy.resetForm("queryRef")
  handleQuery()
}

// 查看按钮
const edit = async (row) => {
  reset()
  const id = row.id
  if (row.isDefault == "1") {
    isCopy.value = true
    Default.value = "1"
    title.value = "系统默认经济损失计算模型"
  } else {
    isCopy.value = false
    Default.value = "0"
    title.value = "经济损失计算模型"
  }

  await getModelEconomic(id).then(response => {
    form.value = response.data
    form.value.provinceId = response.data.province
    if (form.value.provinceId) {
      getChildArea(form.value.provinceId).then(res => {
        cityFormData.value = res.data
        form.value.cityId = response.data.city.split(',')
      })
    }

    open.value = true
    if (form.value.city == "全部") {
      radio.value = "1"
      isCityEdit.value = true
    } else {
      radio.value = "2"
      isCityEdit.value = false
    }
    if (form.value.isDefault == "0") {
      isEditDefault.value = true
    } else {
      isEditDefault.value = false
    }
  })
}

// 复制
function copyForm() {
  if (form.value.isDefault == '1') {
    title.value = "复制经济损失计算模型"
  } else {
    title.value = "修改经济损失计算模型"
  }
  isCopy.value = false
  form.value.isDefault = "0"
}

// 新增
function saveForm() {
  proxy.$refs["economicRef"].validate(valid => {
    if (valid) {
      if (radio.value == "1") {
        form.value.cityId = "全部"
      } else {
        if (form.value.cityId != null) {
          form.value.cityId = JSON.parse(JSON.stringify(form.value.cityId)).join(",")
        }
      }
      form.value.province = form.value.provinceId
      form.value.city = form.value.cityId
      form.value.cityId = form.value.cityId.split(',')
      addEconomic(form.value).then(response => {
        proxy.$modal.msgSuccess("新增成功")
        open.value = false
        getList()
      })
    }
  })
}
// 编辑
function editForm() {
  proxy.$refs["economicRef"].validate(valid => {
    if (valid) {
      updateEconomic(form.value).then(response => {
        if (response.message == "修改失败，只能修改自己创建的模型") {
          proxy.$modal.msgWarning(response.message)
        } else {
          proxy.$modal.msgSuccess(response.data);
          open.value = false
          getList()
        }
      })
    }
  })
}
// 删除
function delForm() {
  const id = form.value.id
  proxy.$modal.confirm('是否确认删除？').then(function () {
    return delEconomic(id)
  }).then((response) => {
    if (response.message == "删除失败，只能删除自己创建的模型") {
      proxy.$modal.msgWarning(response.message)
    } else {
      proxy.$modal.msgSuccess(response.message)
      open.value = false
      getList()
    }
  }).catch(() => { })
}

getList();
getProvinceData();
getProvinceFormData();
</script>
<style scoped lang="scss">
.tab-title {
  font-size: 16px;
  font-weight: bold;
  border-left: 4px solid var(--el-color-primary);;
  font-family: PingFangSC-Medium;
  padding-left: 10px;
  margin-bottom: 20px;
}

// #lineTd {
//   background: #fff url() no-repeat 100% center;
// }

// #lineTd:after {
//   content: '';
//   width: 1px;
//   height: 100px;
//   border-bottom: 1px solid pink;
// }

table td {
  border: 1px solid #c6c6c6;
}

table {
  .el-form-item--default {
    margin: 15px 5px;
  }
}

:deep(.el-input-number) {
  width: auto;

  &>span {
    display: none;
  }

  .el-input__inner {
    padding: 0 10px;
  }
}
</style>
<style lang="scss">
.economic-model-dialog {
  height: 85%;
  overflow: hidden;

  &>.el-dialog__body {
    height: calc(100% - 126px);
    overflow-y: auto;
    padding: 0;

    .el-scrollbar__view {
      padding: 20px;
    }
  }
}
</style>
